//
//  FeedBackDetaileModel.swift
//  Pods
//
//  Created by eme on 2017/4/11.
//
//

import UIKit
import SwiftyJSON
import ModelProtocol

class FeedBackDetaileModel: ModelProtocol {
    
    // MARK: Declaration for string constants to be used to decode and also serialize.
    internal let kFeedBackDetaileAppraiseridKey: String = "appraiserid"
    internal let kFeedBackDetailePicurlKey: String = "picurl"
    internal let kFeedBackDetaileRemarkKey: String = "remark"
    internal let kFeedBackDetaileFeedbackdateKey: String = "feedbackdate"
    internal let kFeedBackDetaileFeedbacksourceKey: String = "feedbacksource"
    internal let kFeedBackDetaileReplydateKey: String = "replydate"
    internal let kFeedBackDetaileReplyKey: String = "reply"
    internal let kFeedBackDetaileFeedbackcommnetKey: String = "feedbackcommnet"
    internal let kFeedBackDetaileFeedbackidKey: String = "feedbackid"
    internal let kFeedBackDetaileDealerKey: String = "dealer"
    internal let kFeedBackDetaileFeedbackstatusKey: String = "feedbackstatus"
    internal let kFeedBackDetaileDealeridKey: String = "dealerid"
    
    
    // MARK: 属性
    var appraiserid: Int
    var picurl: String
    var remark: String
    var feedbackdate: String
    var feedbacksource: String
    var replydate: String
    var reply: String
    var feedbackcommnet: String
    var feedbackid: Int
    var dealer: String
    var feedbackstatus: String
    var dealerid: String
    var picArr:[String]{
        get{
            let urlStr = picurl as NSString
            let picArr = urlStr.components(separatedBy: ",")
            return picArr
        }
    }
    
    
    // MARK: 实现MikerSwiftJSONAble 协议， 解析json数据
    required  init?(json: JSON) {
        appraiserid = json[kFeedBackDetaileAppraiseridKey].intValue
        picurl = json[kFeedBackDetailePicurlKey].stringValue
        remark = json[kFeedBackDetaileRemarkKey].stringValue
        feedbackdate = json[kFeedBackDetaileFeedbackdateKey].stringValue
        feedbacksource = json[kFeedBackDetaileFeedbacksourceKey].stringValue
        replydate = json[kFeedBackDetaileReplydateKey].stringValue
        reply = json[kFeedBackDetaileReplyKey].stringValue
        feedbackcommnet = json[kFeedBackDetaileFeedbackcommnetKey].stringValue
        feedbackid = json[kFeedBackDetaileFeedbackidKey].intValue
        dealer = json[kFeedBackDetaileDealerKey].stringValue
        feedbackstatus = json[kFeedBackDetaileFeedbackstatusKey].stringValue
        dealerid = json[kFeedBackDetaileDealeridKey].stringValue
        
    }
    
    
    /**
     Generates description of the object in the form of a NSDictionary.
     - returns: A Key value pair containing all valid values in the object.
     */
    internal func dictionaryRepresentation() -> [String : AnyObject ] {
        
        var dictionary: [String : AnyObject ] = [ : ]
        
        dictionary.updateValue(appraiserid as AnyObject, forKey: kFeedBackDetaileAppraiseridKey)
    
        dictionary.updateValue(picurl as AnyObject, forKey: kFeedBackDetailePicurlKey)
    
        dictionary.updateValue(remark as AnyObject, forKey: kFeedBackDetaileRemarkKey)
    
        dictionary.updateValue(feedbackdate as AnyObject, forKey: kFeedBackDetaileFeedbackdateKey)
    
        dictionary.updateValue(feedbacksource as AnyObject, forKey: kFeedBackDetaileFeedbacksourceKey)
    
        dictionary.updateValue(replydate as AnyObject, forKey: kFeedBackDetaileReplydateKey)
    
        dictionary.updateValue(reply as AnyObject, forKey: kFeedBackDetaileReplyKey)
    
        dictionary.updateValue(feedbackcommnet as AnyObject, forKey: kFeedBackDetaileFeedbackcommnetKey)
    
        dictionary.updateValue(feedbackid as AnyObject, forKey: kFeedBackDetaileFeedbackidKey)
    
        dictionary.updateValue(dealer as AnyObject, forKey: kFeedBackDetaileDealerKey)
    
        dictionary.updateValue(feedbackstatus as AnyObject, forKey: kFeedBackDetaileFeedbackstatusKey)
    
        dictionary.updateValue(dealerid as AnyObject, forKey: kFeedBackDetaileDealeridKey)
        
        return dictionary
    }
    
    
}
